/* API function ecrire */
void ecrire(char* string){
	/* uses the system call print_str(), using the syscall mechanism */
	move a0, string
	move v0, code_of_print_str
	syscall
}

/* print_str system call  */
void print_str(char* string){
	/* the process tries to become the current owner of the device */
	get_uart(pcb);
	int i = 0;
	while(string[i] != '\0'){
		print(string[i++]);
	}
	/* we are done with the device, we release it */
	release_uart();
}

/* UART module's function print */
void print(char c){
	/* waiting for the transmitter to be ready */
	while(! transmitter holding register empty);
	/* sets the data */
	THR register = c;
	/* sets the device to generate an interrupt when the printing is done */
	etbei = 1;
	/* the owner is blocked until the I/O is done */
	block_owner();
}

/* part of the interrupt vector */
if(interrupt from the UART)
	if(IIR == transmitter holding register empty)
		/* wakes the owner of the device up */
		wake_up_owner();
